##
# SVN version is taken from svn info or read from a cached file.
#
# SVN info taken from ".svn" if sources are checked out from repository
#
# It pass 2 params to Automake makefile:
#
# SVN_REDISTR_COMMAND - command used at dist target. It could include re-checking with SVN command or empty.
# SVN_REVISION_NO - This is SVN revision number.
#
##
AC_DEFUN([AC_SVN_INFO_VERSION],
[
  if test -d "$srcdir/.svn"; then
    svn info "$srcdir" > "$srcdir/svn.info"
    SVN_REDISTR_COMMAND="svn info \"$srcdir\" > \"$srcdir/svn.info\""
  else
    SVN_REDISTR_COMMAND="ls \"$srcdir/svn.info\""
  fi
  AC_SUBST(SVN_REDISTR_COMMAND)

  SVN_REVISION_NO=`cat svn.info | grep -P "Revision:\s(\d)+" | grep -o -P "(\d)+"`
  AC_MSG_NOTICE([SVN revision : $SVN_REVISION_NO ])

  AC_SUBST(SVN_REVISION_NO)
])

